import ajax from '../../lib/ajax';
import Util from '@/lib/util';
import {Store,Module,ActionContext} from 'vuex' 
import Cookies from 'js-cookie';

interface SessionState{
    application:any,
    user:any,
    tenant:any
}
class SessionStore implements Module<SessionState,any>{
    namespaced=true;
    state={
        application:null,
        user:null,
        tenant:null,
    }
    actions={
        async init(content:ActionContext<SessionState,any>){
            const oper_id = Cookies.get('oper_id')
            Util.abp.session.userId = oper_id
            const token = Cookies.get('token')
            content.state.user = { oper_id, token };
        }
    }
}
const session=new SessionStore();
export default session;